package com.yingxin.yxerp.module.sys.entity.enums;

import java.util.HashMap;
import java.util.Map;

public class DingChatHelper {

    private static final Map<String, DingChatType> map = new HashMap<>();

    public static void init() {
        if (map.size() == 0) {
            for (DingChatType type : DingChatType.values()) {
                map.put(type.getType(), type);
            }
        }
    }

    public static String getName(String id) {
        init();
        DingChatType type = map.get(id);
        if (type != null) {
            return type.getTypeName();
        }
        return null;
    }


    public static DingChatType get(String id) {
        init();
        return map.get(id);
    }

}